//
//  GHOrderTableViewCell.m
//  GodHorses
//
//  Created by Mac on 2017/11/17.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "KLMineShopTableViewCell.h"
@interface KLMineShopTableViewCell ()

@property(nonatomic, strong) UIImageView                     *goodBanerImageView;
@property(nonatomic, strong) STLabel                         *titleLable;//名字
@property(nonatomic, strong) STLabel                         *addLable;//地址

@property(nonatomic, strong) STLabel                         *moneyLable;//好多钱
@property(nonatomic, strong) STLabel                         *desLable;//售出

@end
@implementation KLMineShopTableViewCell

+ (CGFloat)CellHeight{
    return 140;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
#pragma mark --subView
- (void)configSubView{
    self.backgroundColor = [UIColor whiteColor];
    
    //商品
    UIView * grayView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 120)];
    grayView.backgroundColor  = [UIColor whiteColor];
    [self addSubview:grayView];
    
    self.goodBanerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 90, 100)];
    self.goodBanerImageView.image = [UIImage imageNamed:@"06"];
    [grayView addSubview:self.goodBanerImageView];
    
    self.titleLable = [[STLabel alloc] initWithFrame:CGRectMake(self.goodBanerImageView.right + 10, self.goodBanerImageView.top + 5, UIScreenWidth - 20 - self.goodBanerImageView.right, 20)
                                                text:@"dasdasdasd大酒店"
                                           textColor:KL_firstTextColor
                                                font:14
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];
    self.titleLable.numberOfLines = 0;
    [grayView addSubview:self.titleLable];
    
    self.addLable = [[STLabel alloc] initWithFrame:CGRectMake(self.goodBanerImageView.right + 10, self.titleLable.bottom , UIScreenWidth - 20 - self.goodBanerImageView.right, 20)
                                              text:@"4.5分 北京市海定区大家开始多久啊"
                                         textColor:KL_firstTextColor
                                              font:14
                                       isSizetoFit:NO
                                     textAlignment:NSTextAlignmentLeft];
    self.addLable.numberOfLines = 0;
    [grayView addSubview:self.addLable];
    
    self.moneyLable = [[STLabel alloc] initWithFrame:CGRectMake(self.goodBanerImageView.right + 10, self.addLable.st_bottom + 10 , 120, 16)
                                                text:@"￥1374"
                                           textColor:KL_redColor
                                                font:15
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];
    [grayView addSubview:self.moneyLable];
    
    self.changeButton = [[STButton alloc] initWithFrame:CGRectMake(0, 0, 70, 30)
                                                  title:@"修改商品"
                                             titleColor:[UIColor whiteColor]
                                              titleFont:14
                                           cornerRadius:5
                                        backgroundColor:KL_BlueBackGroundColor
                                        backgroundImage:nil
                                                  image:nil];
    self.changeButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.changeButton.right = UIScreenWidth - 15;
    self.changeButton.centerY = self.moneyLable.centerY;
    self.changeButton.hidden = YES;
    [self addSubview:self.changeButton];
    

    
    self.desLable = [[STLabel alloc] initWithFrame:CGRectMake(self.goodBanerImageView.right + 10, self.goodBanerImageView.st_bottom , 200, 20)
                                              text:@"---"
                                         textColor:KL_secendTextColor
                                              font:15
                                       isSizetoFit:NO
                                     textAlignment:NSTextAlignmentRight];
    self.desLable.right = UIScreenWidth - 10;
    [grayView addSubview:self.desLable];
    
    
    UIView * grawView = [[UIView alloc] initWithFrame:CGRectMake(0, self.desLable.bottom, UIScreenWidth, 10)];
    grawView.backgroundColor = KL_backgroundColor;
    [self addSubview:grawView];
    
    
}

- (void)setModel:(KLGoodDetailModel *)model{
    _model = model;
    [self.goodBanerImageView sd_setImageWithURL:[NSURL URLWithString:model.exhibition_map] placeholderImage:KL_placeHoderImage];
    
    self.titleLable.text = [NSString stringWithFormat:@"%@",model.goods_name];
    
    self.addLable.text = model.abstract;
    
    self.moneyLable.text = [NSString stringWithFormat:@"￥%@",model.price];
    
    self.desLable.text = [NSString stringWithFormat:@"已售出:%@  库存:%@",model.sell_num,model.stock];
    
}
@end


